package com.candy.control;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/bookList")
public class ShoppingListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//       获取session对象
        HttpSession session=req.getSession();
//        从session中取出信息
        String[] booklist=(String[])session.getAttribute("shopcar");
//        遍历购物车中选择的书籍ID
        for(String bookinfo:booklist){
            resp.getWriter().println(bookinfo);
        }

    }
}
